package com.jeesite.modules.kj.utils;

import com.jeesite.common.utils.SpringUtils;
import com.jeesite.modules.kj.entity.KjLike;
import com.jeesite.modules.kj.entity.KjServiceType;
import com.jeesite.modules.kj.service.KjLikeService;
import com.jeesite.modules.kj.service.KjServiceTypeService;

import java.util.List;

/**
 * 点赞工具类
 */
public class ServiceTypeUtil {
    /*
     * 静态内部类，延迟加载，懒汉式，线程安全的单例模式
     */
    private static final class Static {
        private static KjServiceTypeService kjServiceTypeService = SpringUtils.getBean(KjServiceTypeService.class);
    }


    public static KjServiceType getServiceTypeByCode(String code){
        KjServiceType where = new KjServiceType();
        where.setCode(code);
        List<KjServiceType> typeList = Static.kjServiceTypeService.findList(where);
        return typeList.size() > 0 ? typeList.get(0) : new KjServiceType();
    }


}
